package com.albd.utils;

import android.app.ActivityManager;
import android.content.Context;
import android.os.Debug;
import android.util.Log;

public final class LogUtil
{

	public static final boolean BL_DEBUG = true;// BinderListener

	// Verify debug control
	//phone pro
	public static final boolean VERIFY_ITL = false;
	public static final boolean VERIFY_PCP = false;
	public static final boolean VERIFY_SMS = false;
	public static final boolean VERIFY_IPI = false;
	//ended phone
	//system server pro
	public static final boolean VERIFY_IAM = true;
	public static final boolean VERIFY_BLT = false;
	public static final boolean VERIFY_WIFI = false;
	public static final boolean VERIFY_NETWORK = false;	
	public static final boolean VERIFY_ILM = false;
	//ended system server
	//acore pro
	public static final boolean VERIFY_ICP = false;
	//ended acore pro
	// ended Verify

	private static final String LOG_TAG = "AgjMon";
	private static final boolean DEBUG = true;

	public static void w(String tag, String msg, boolean debug)
	{
		if(DEBUG)
		{
			if(debug)
			{
				Log.w(LOG_TAG, tag + " " + msg);
			}
		}
	}

	public static void e(String tag, String msg, boolean debug)
	{
		if(DEBUG)
		{
			if(debug)
			{
				Log.e(LOG_TAG, tag + " " + msg);
			}
		}
	}

	public static void d(String tag, String msg, boolean debug)
	{
		if(DEBUG)
		{
			if(debug)
			{
				Log.d(tag, tag + " " + msg);//todo ks_test
			}
		}
	}

	public static void i(String tag, String msg, boolean debug)
	{
		if(DEBUG)
		{
			if(debug)
			{
				Log.i(LOG_TAG, tag + " " + msg);
			}
		}
	}

	public static void v(String tag, String msg, boolean debug)
	{
		if(DEBUG)
		{
			if(debug)
			{
				Log.v(LOG_TAG, tag + " " + msg);
			}
		}
	}

	public static void logNativeHeapInfo()
	{
		if(DEBUG)
		{
			Log.e(LOG_TAG, "NativeHeap >>>>>> " + "Allocated: " + Debug.getNativeHeapAllocatedSize() + " , Free: " + Debug.getNativeHeapFreeSize()
							+ " , Heap: " + Debug.getNativeHeapSize());
		}
	}

	public static void logMemoryInfo(Context context)
	{
		if(context == null || !DEBUG) { return; }

		ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
		ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
		am.getMemoryInfo(memoryInfo);
		Log.e(LOG_TAG, "MemoryInfo >>>>>> " + "availMem: " + memoryInfo.availMem + " , threshold: " + memoryInfo.threshold + " , lowMemory?: "
						+ memoryInfo.lowMemory);
	}

}
